#include <stdio.h>  
#include <math.h>  
int vl[5];  
int bucket[10005];  
int main(int argc, char **argv) {  
    for (int i = 1; i < 5; i++)  
        scanf("%d", &vl[i]);  
    for (int i1 = 0; i1 < 5; i1++)  
        for (int i2 = 0; i2 < 5; i2++)  
            for (int i3 = 0; i3 < 5; i3++)  
                for (int i4 = 0; i4 < 5; i4++)  
                    for (int i5 = 0; i5 < 5; i5++)  
                        bucket[vl[i1] + vl[i2] + vl[i3] + vl[i4] + vl[i5]] = 1;  
    int i = 0;  
    while (bucket[++i]);  
    printf("The max is %d.\n", i - 1);  
    return 0;  
}  